#!/usr/bin/python3
import sys

rna_pass = {'A': 'U', 'U': 'A', 'C': 'G', 'G': 'C'}
try:
    n = int(input())
    if n < 1 or n > 100:
        sys.exit(0)
    for x in range(n):
        s = input()
        if s != "":
            r = ""
            for i in range(len(s)):
                r = r + rna_pass[s[i]]

            print("Case #%d: %s" % (x + 1, r))
        else:
            break
except ValueError:
    pass
except EOFError:
    pass
except MemoryError:
    pass
